﻿namespace AC.ExtendedRenderer.Navigator
{
    using AC.ExtendedRenderer.Toolkit.Drawing;
    using AC.ExtendedRenderer.Toolkit.Navigator;
    using AC.ExtendedRenderer.Toolkit.Utils;
    using ComponentFactory.Krypton.Toolkit;
    using System;
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Design;
    using System.Drawing.Drawing2D;
    using System.Drawing.Text;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;
    using System.Security.Permissions;
    using System.Text;
    using System.Windows.Forms;

    [ToolboxBitmap(typeof(TabControl))]
    public class KryptonTabControl : TabControl
    {
        private bool _allowCloseButton;
        private bool _allowContextButton = true;
        private bool _allowInternalNavigatorButtons;
        private bool _allowNavigatorButtons;
        private bool _allowSelectedTabHigh;
        private int _allowSelectedTabHighSize;
        private Color _borderColor = SystemColors.ControlDark;
        private int _borderWidth = 1;
        private Color _buttonsBackColor = SystemColors.Control;
        private Color _buttonsBorderColor = SystemColors.ControlDark;
        private int _cornerLeftWidth;
        private int _cornerRightWidth;
        private int _cornerRoundRadiusWidth = 12;
        private int _cornerSymmetry;
        private AC.ExtendedRenderer.Toolkit.Drawing.DrawingMethods.CornerType _cornerType;
        private int _cornerWidth = 2;
        private IDisposable _mementoBack1;
        private IDisposable _mementoBack2;
        private IDisposable _mementoContent;
        private IPalette _palette;
        private PaletteBackInheritRedirect _paletteBack;
        private PaletteBorderInheritRedirect _paletteBorder;
        private PaletteContentInheritRedirect _paletteContent;
        private PaletteRedirect _paletteRedirect;
        private bool _preserveTabColor;
        private Color _standardBackColor = SystemColors.Control;
        private Color _tabColorDefaultDark = Color.FromArgb(0xc2, 0xe0, 0xff);
        private Color _tabColorDefaultLight = Color.FromArgb(0xc2, 0xe0, 0xff);
        private Color _tabColorHotDark = Color.FromArgb(0xff, 0xd7, 0x53);
        private Color _tabColorHotLight = Color.FromArgb(0xff, 0xf1, 0xc4);
        private Color _tabColorPressedDark = Color.FromArgb(0xfe, 0xb6, 0x5d);
        private Color _tabColorPressedLight = Color.FromArgb(0xff, 0xe5, 0xc4);
        private Color _tabColorSelectedDark = Color.FromArgb(0xfe, 0xb6, 0x5d);
        private Color _tabColorSelectedLight = Color.FromArgb(0xff, 0xe5, 0xc4);
        private Color _tabForeColor = SystemColors.ControlText;
        private Color _tabHotForeColor = SystemColors.HotTrack;
        private Color _tabSelectedForeColor = SystemColors.Highlight;
        private bool _useExtendedLayout;
        private Container components;
        private bool FlagControl;
        private ImageList leftRightImages;
        private Rectangle m_closeRect = new Rectangle();
        private const int nMargin = 5;
        private Point pt = new Point();
        private TabScroller Scroller = new TabScroller();
        private SubClass scUpDown;
        private NativeUpDown UpDown;

        public KryptonTabControl()
        {
            base.SetStyle(ControlStyles.UserPaint, true);
            base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            base.SetStyle(ControlStyles.DoubleBuffer, true);
            base.SetStyle(ControlStyles.ResizeRedraw, true);
            base.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            this.InitializeComponent();
            this.Scroller.ScrollLeft += new EventHandler(this.Scroller_ScrollLeft);
            this.Scroller.ScrollRight += new EventHandler(this.Scroller_ScrollRight);
            this.Scroller.TabClose += new EventHandler(this.Scroller_TabClose);
            this.Scroller.ContextualMenu += new EventHandler(this.Scroller_ContextMenuButton);
            this._palette = KryptonManager.CurrentGlobalPalette;
            if (this._palette != null)
            {
                this._palette.PalettePaint += new EventHandler<PaletteLayoutEventArgs>(this.OnPalettePaint);
            }
            KryptonManager.GlobalPaletteChanged += new EventHandler(this.OnGlobalPaletteChanged);
            this._paletteRedirect = new PaletteRedirect(this._palette);
            this._paletteBack = new PaletteBackInheritRedirect(this._paletteRedirect);
            this._paletteBorder = new PaletteBorderInheritRedirect(this._paletteRedirect);
            this._paletteContent = new PaletteContentInheritRedirect(this._paletteRedirect);
            this.InitColors();
        }

        [PermissionSet(SecurityAction.Demand, Name="FullTrust")]
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (this._mementoContent != null)
                {
                    this._mementoContent.Dispose();
                    this._mementoContent = null;
                }
                if (this._mementoBack1 != null)
                {
                    this._mementoBack1.Dispose();
                    this._mementoBack1 = null;
                }
                if (this._mementoBack2 != null)
                {
                    this._mementoBack2.Dispose();
                    this._mementoBack2 = null;
                }
                if (this._palette != null)
                {
                    this._palette.PalettePaint -= new EventHandler<PaletteLayoutEventArgs>(this.OnPalettePaint);
                    this._palette = null;
                }
                KryptonManager.GlobalPaletteChanged -= new EventHandler(this.OnGlobalPaletteChanged);
                if (this.UpDown != null)
                {
                    this.UpDown.ReleaseHandle();
                }
            }
            base.Dispose(disposing);
        }

        internal void DrawControl(Graphics g)
        {
            if (base.Visible)
            {
                Rectangle rectangle3;
                Rectangle clientRectangle = base.ClientRectangle;
                Rectangle displayRectangle = this.DisplayRectangle;
                Brush brush = new SolidBrush(this._standardBackColor);
                g.FillRectangle(brush, clientRectangle);
                brush.Dispose();
                int width = SystemInformation.Border3DSize.Width;
                Pen pen = new Pen(this._borderColor, (float) this._borderWidth);
                displayRectangle.Inflate(width, width);
                g.DrawRectangle(pen, displayRectangle);
                pen.Dispose();
                Region clip = g.Clip;
                int num2 = displayRectangle.Width + 5;
                num2 -= this.Scroller.Width;
                if ((base.Alignment == TabAlignment.Top) || (base.Alignment == TabAlignment.Bottom))
                {
                    rectangle3 = new Rectangle(displayRectangle.Left, clientRectangle.Top, num2 - 5, clientRectangle.Height);
                }
                else
                {
                    rectangle3 = base.ClientRectangle;
                }
                g.SetClip(rectangle3);
                for (int i = 0; i < base.TabCount; i++)
                {
                    this.DrawTab(g, this.TabPages[i], i);
                }
                g.Clip = clip;
                if (base.SelectedTab != null)
                {
                    pen = new Pen(base.SelectedTab.BackColor);
                    displayRectangle.Offset(1, 1);
                    displayRectangle.Width -= 2;
                    displayRectangle.Height -= 2;
                    g.DrawRectangle(pen, displayRectangle);
                    displayRectangle.Width--;
                    displayRectangle.Height--;
                    g.DrawRectangle(pen, displayRectangle);
                    pen.Dispose();
                }
            }
        }

        internal void DrawIcons(Graphics g)
        {
            if ((this.leftRightImages != null) && (this.leftRightImages.Images.Count == 4))
            {
                Rectangle clientRectangle = base.ClientRectangle;
                Rectangle rect = new Rectangle();
                Win32.GetClientRect(this.scUpDown.Handle, ref rect);
                Brush brush = new SolidBrush(this._buttonsBackColor);
                rect.Width--;
                g.FillRectangle(brush, rect);
                brush.Dispose();
                Pen pen = new Pen(this._buttonsBorderColor);
                Rectangle rectangle3 = rect;
                rectangle3.Height--;
                rectangle3.Width = rectangle3.Width;
                g.DrawRectangle(pen, rectangle3);
                pen.Dispose();
                int num = rect.Width / 2;
                int y = (rect.Height - 0x10) / 2;
                int x = (num - 0x10) / 2;
                Rectangle rectangle4 = new Rectangle(x, y, 0x10, 0x10);
                Rectangle rectangle5 = new Rectangle(num + x, y, 0x10, 0x10);
                Image image = this.leftRightImages.Images[1];
                if ((image != null) && (base.TabCount > 0))
                {
                    if (base.GetTabRect(0).Left < clientRectangle.Left)
                    {
                        g.DrawImage(image, rectangle4);
                    }
                    else
                    {
                        image = this.leftRightImages.Images[3];
                        if (image != null)
                        {
                            g.DrawImage(image, rectangle4);
                        }
                    }
                }
                image = this.leftRightImages.Images[0];
                if ((image != null) && (base.TabCount > 0))
                {
                    if (base.GetTabRect(base.TabCount - 1).Right > (clientRectangle.Width - rect.Width))
                    {
                        g.DrawImage(image, rectangle5);
                    }
                    else
                    {
                        image = this.leftRightImages.Images[2];
                        if (image != null)
                        {
                            g.DrawImage(image, rectangle5);
                        }
                    }
                }
                base.Invalidate();
            }
        }

        internal void DrawTab(Graphics g, TabPage tabPage, int nIndex)
        {
            Point[] pointArray;
            Point[] pointArray2;
            GraphicsPath roundedSquarePath;
            GraphicsPath path2;
            Rectangle tabRect = base.GetTabRect(nIndex);
            RectangleF layoutRectangle = base.GetTabRect(nIndex);
            if (tabRect.Width == 0)
            {
                tabRect.Width = 50;
            }
            if (layoutRectangle.Width == 0f)
            {
                layoutRectangle.Width = 50f;
            }
            if (tabRect.Height == 0)
            {
                tabRect.Width = 0x16;
            }
            if (layoutRectangle.Height == 0f)
            {
                layoutRectangle.Width = 22f;
            }
            bool flag = base.SelectedIndex == nIndex;
            bool tag = false;
            if (tabPage.Tag != null)
            {
                try
                {
                    tag = (bool) tabPage.Tag;
                }
                catch (Exception)
                {
                    tag = false;
                }
            }
            if (base.Appearance != TabAppearance.Normal)
            {
                this._cornerLeftWidth = 0;
                this._cornerRightWidth = 0;
                this._cornerWidth = 0;
                this._cornerRoundRadiusWidth = 2;
                base.Alignment = TabAlignment.Top;
            }
            if (this._cornerRoundRadiusWidth > 0x20)
            {
                this._cornerRoundRadiusWidth = 0x20;
            }
            DrawingMethods.TabHeaderStatus normal = DrawingMethods.TabHeaderStatus.Normal;
            if (this._preserveTabColor)
            {
                normal = DrawingMethods.TabHeaderStatus.NormalPreserve;
            }
            if (tag)
            {
                normal = DrawingMethods.TabHeaderStatus.Hot;
            }
            if (flag && !tag)
            {
                normal = DrawingMethods.TabHeaderStatus.Selected;
            }
            else if (flag && tag)
            {
                normal = DrawingMethods.TabHeaderStatus.HotSelected;
            }
            if (!this._allowSelectedTabHigh)
            {
                this._allowSelectedTabHighSize = 0;
            }
            else
            {
                this._allowSelectedTabHighSize = 2;
            }
            if ((base.Alignment != TabAlignment.Top) && (base.Alignment != TabAlignment.Right))
            {
                TabAlignment alignment = base.Alignment;
            }
            Brush brush = new SolidBrush(tabPage.BackColor);
            Color white = new Color();
            Font font = this.Font;
            switch (this._cornerType)
            {
                case AC.ExtendedRenderer.Toolkit.Drawing.DrawingMethods.CornerType.Rounded:
                    roundedSquarePath = DrawingMethods.GetTabRoundedPath(tabRect, this._cornerRoundRadiusWidth, base.Alignment, false, normal, base.Appearance, this._allowSelectedTabHighSize);
                    path2 = DrawingMethods.GetTabRoundedPath(tabRect, this._cornerRoundRadiusWidth, base.Alignment, true, normal, base.Appearance, this._allowSelectedTabHighSize);
                    if (base.Appearance != TabAppearance.Normal)
                    {
                        roundedSquarePath = DrawingMethods.GetRoundedSquarePath(tabRect, 8);
                        Rectangle bounds = tabRect;
                        bounds.Offset(1, 1);
                        bounds.Height -= 2;
                        bounds.Width -= 2;
                        path2 = DrawingMethods.GetRoundedSquarePath(bounds, 8);
                    }
                    switch (normal)
                    {
                        case DrawingMethods.TabHeaderStatus.Normal:
                            DrawingMethods.DrawTabHeader(g, roundedSquarePath, tabRect, this._tabColorDefaultLight, this._tabColorDefaultDark, this._tabColorDefaultLight, 90f, base.Alignment, this._useExtendedLayout, normal, false);
                            brush = new SolidBrush(this._tabForeColor);
                            white = this._tabColorDefaultDark;
                            goto Label_0735;

                        case DrawingMethods.TabHeaderStatus.NormalPreserve:
                            DrawingMethods.DrawTabHeader(g, roundedSquarePath, tabRect, Color.White, DrawingMethods.GetModifiedColor(tabPage.BackColor, -20, 7, 0), tabPage.BackColor, 90f, base.Alignment, this._useExtendedLayout, normal, true);
                            brush = new SolidBrush(this._tabForeColor);
                            white = Color.White;
                            goto Label_0735;

                        case DrawingMethods.TabHeaderStatus.Hot:
                            DrawingMethods.DrawTabHeader(g, roundedSquarePath, tabRect, this._tabColorHotLight, this._tabColorHotDark, DrawingMethods.GetLighterColor(this._tabColorHotLight), 90f, base.Alignment, this._useExtendedLayout, normal, false);
                            brush = new SolidBrush(this._tabHotForeColor);
                            white = this._tabColorHotDark;
                            goto Label_0735;

                        case DrawingMethods.TabHeaderStatus.Selected:
                            if (base.Appearance != TabAppearance.Normal)
                            {
                                DrawingMethods.DrawTabHeader(g, roundedSquarePath, tabRect, this._tabColorSelectedLight, this._tabColorSelectedDark, tabPage.BackColor, 90f, base.Alignment, this._useExtendedLayout, normal, false);
                                white = this._tabColorPressedLight;
                            }
                            else
                            {
                                DrawingMethods.DrawTabHeader(g, roundedSquarePath, tabRect, tabPage.BackColor, this._tabColorSelectedDark, tabPage.BackColor, 90f, base.Alignment, this._useExtendedLayout, normal, false);
                                white = this._tabColorSelectedLight;
                            }
                            font = new Font(this.Font.FontFamily, this.Font.SizeInPoints, FontStyle.Bold);
                            brush = new SolidBrush(this._tabSelectedForeColor);
                            goto Label_0735;

                        case DrawingMethods.TabHeaderStatus.HotSelected:
                            if (base.Appearance != TabAppearance.Normal)
                            {
                                DrawingMethods.DrawTabHeader(g, roundedSquarePath, tabRect, this._tabColorPressedLight, this._tabColorPressedDark, this._tabColorPressedLight, 90f, base.Alignment, this._useExtendedLayout, normal, false);
                                white = this._tabColorPressedLight;
                            }
                            else
                            {
                                DrawingMethods.DrawTabHeader(g, roundedSquarePath, tabRect, tabPage.BackColor, this._tabColorPressedDark, tabPage.BackColor, 90f, base.Alignment, this._useExtendedLayout, normal, false);
                                white = this._tabColorPressedLight;
                            }
                            font = new Font(this.Font.FontFamily, this.Font.SizeInPoints, FontStyle.Bold);
                            brush = new SolidBrush(this._tabSelectedForeColor);
                            goto Label_0735;
                    }
                    goto Label_0735;

                case AC.ExtendedRenderer.Toolkit.Drawing.DrawingMethods.CornerType.Squared:
                    pointArray = DrawingMethods.GetTabSquaredPoints(tabRect, this._cornerWidth, base.Alignment, this._cornerLeftWidth, this._cornerRightWidth, base.Appearance, normal, this._allowSelectedTabHighSize, false);
                    pointArray2 = DrawingMethods.GetTabSquaredPoints(tabRect, this._cornerWidth, base.Alignment, this._cornerLeftWidth, this._cornerRightWidth, base.Appearance, normal, this._allowSelectedTabHighSize, true);
                    switch (normal)
                    {
                        case DrawingMethods.TabHeaderStatus.Normal:
                            DrawingMethods.DrawTabHeader(g, pointArray, tabRect, this._tabColorDefaultLight, this._tabColorDefaultDark, this._tabColorDefaultLight, 90f, base.Alignment, this._useExtendedLayout, normal, false);
                            brush = new SolidBrush(this._tabForeColor);
                            white = this._tabColorDefaultDark;
                            break;

                        case DrawingMethods.TabHeaderStatus.NormalPreserve:
                            DrawingMethods.DrawTabHeader(g, pointArray, tabRect, Color.White, DrawingMethods.GetModifiedColor(tabPage.BackColor, -20, 7, 0), tabPage.BackColor, 90f, base.Alignment, this._useExtendedLayout, normal, true);
                            brush = new SolidBrush(this._tabForeColor);
                            white = Color.White;
                            break;

                        case DrawingMethods.TabHeaderStatus.Hot:
                            DrawingMethods.DrawTabHeader(g, pointArray, tabRect, this._tabColorHotLight, this._tabColorHotDark, DrawingMethods.GetLighterColor(this._tabColorHotLight), 90f, base.Alignment, this._useExtendedLayout, normal, false);
                            brush = new SolidBrush(this._tabHotForeColor);
                            white = this._tabColorHotDark;
                            break;

                        case DrawingMethods.TabHeaderStatus.Selected:
                            if (base.Appearance == TabAppearance.Normal)
                            {
                                DrawingMethods.DrawTabHeader(g, pointArray, tabRect, tabPage.BackColor, this._tabColorSelectedDark, tabPage.BackColor, 90f, base.Alignment, this._useExtendedLayout, normal, false);
                                white = this._tabColorSelectedLight;
                            }
                            else
                            {
                                DrawingMethods.DrawTabHeader(g, pointArray, tabRect, this._tabColorSelectedLight, this._tabColorSelectedDark, tabPage.BackColor, 90f, base.Alignment, this._useExtendedLayout, normal, false);
                                white = this._tabColorPressedLight;
                            }
                            font = new Font(this.Font.FontFamily, this.Font.SizeInPoints, FontStyle.Bold);
                            brush = new SolidBrush(this._tabSelectedForeColor);
                            break;

                        case DrawingMethods.TabHeaderStatus.HotSelected:
                            if (base.Appearance == TabAppearance.Normal)
                            {
                                DrawingMethods.DrawTabHeader(g, pointArray, tabRect, tabPage.BackColor, this._tabColorPressedDark, tabPage.BackColor, 90f, base.Alignment, this._useExtendedLayout, normal, false);
                                white = this._tabColorPressedLight;
                            }
                            else
                            {
                                DrawingMethods.DrawTabHeader(g, pointArray, tabRect, this._tabColorPressedLight, this._tabColorPressedDark, this._tabColorPressedLight, 90f, base.Alignment, this._useExtendedLayout, normal, false);
                                white = this._tabColorPressedLight;
                            }
                            font = new Font(this.Font.FontFamily, this.Font.SizeInPoints, FontStyle.Bold);
                            brush = new SolidBrush(this._tabSelectedForeColor);
                            white = this._tabColorPressedLight;
                            break;
                    }
                    break;

                default:
                    goto Label_0771;
            }
            g.SmoothingMode = SmoothingMode.AntiAlias;
            g.DrawPolygon(new Pen(white, 1f), pointArray2);
            g.DrawPolygon(new Pen(this._borderColor, (float) this._borderWidth), pointArray);
            goto Label_0771;
        Label_0735:
            g.SmoothingMode = SmoothingMode.AntiAlias;
            g.DrawPath(new Pen(white, 1f), path2);
            g.DrawPath(new Pen(this._borderColor, (float) this._borderWidth), roundedSquarePath);
            roundedSquarePath.Dispose();
        Label_0771:
            if (((normal == DrawingMethods.TabHeaderStatus.Selected) || (normal == DrawingMethods.TabHeaderStatus.HotSelected)) && (base.Appearance == TabAppearance.Normal))
            {
                Pen pen = new Pen(tabPage.BackColor);
                DrawingMethods.ClearTabSelectedBottomLine(g, tabRect, pen, base.Alignment);
                pen.Dispose();
            }
            if (((tabPage.ImageIndex >= 0) && (base.ImageList != null)) && (base.ImageList.Images[tabPage.ImageIndex] != null))
            {
                int num = 8;
                int num2 = 2;
                Image image = base.ImageList.Images[tabPage.ImageIndex];
                Rectangle rect = new Rectangle(tabRect.X + num, tabRect.Y + 1, image.Width, image.Height);
                float num3 = (num + image.Width) + num2;
                if ((base.Alignment == TabAlignment.Top) || (base.Alignment == TabAlignment.Bottom))
                {
                    num3 = (num + image.Width) + num2;
                    rect.Y += (tabRect.Height - image.Height) / 2;
                    layoutRectangle.X += num3;
                    layoutRectangle.Width -= num3;
                }
                else
                {
                    if (!this._useExtendedLayout)
                    {
                        image.RotateFlip(RotateFlipType.Rotate90FlipNone);
                        rect.X -= 5;
                    }
                    rect.Y += 3;
                    num3 = 10 + image.Height;
                    layoutRectangle.Y += image.Height;
                    layoutRectangle.Height -= image.Height;
                }
                g.DrawImage(image, rect);
            }
            else if (this._useExtendedLayout)
            {
                layoutRectangle.Y += 16f;
                layoutRectangle.Height -= 16f;
            }
            StringFormat format = new StringFormat();
            format.Alignment = StringAlignment.Center;
            format.LineAlignment = StringAlignment.Center;
            if (this.RightToLeft == RightToLeft.Yes)
            {
                format.FormatFlags = StringFormatFlags.DirectionRightToLeft;
            }
            if (!base.Enabled)
            {
                brush = new SolidBrush(SystemColors.GrayText);
            }
            if ((base.Alignment == TabAlignment.Right) || (base.Alignment == TabAlignment.Left))
            {
                if (!this._useExtendedLayout)
                {
                    format.FormatFlags = StringFormatFlags.DirectionVertical;
                    layoutRectangle.Offset(-3f, -5f);
                }
                else
                {
                    layoutRectangle.Height += 8f;
                    layoutRectangle.Offset(4f, -12f);
                    format.FormatFlags = StringFormatFlags.NoWrap;
                    format.Trimming = StringTrimming.EllipsisCharacter;
                }
            }
            else
            {
                layoutRectangle.Offset(-5f, 0f);
            }
            if (Utility.IsVista())
            {
                g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
            }
            else
            {
                g.TextRenderingHint = TextRenderingHint.SystemDefault;
            }
            g.DrawString(tabPage.Text, font, brush, layoutRectangle, format);
            brush.Dispose();
        }

        private void FlatTabControl_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Menu)
            {
                this.FlagControl = true;
            }
            else
            {
                this.FlagControl = false;
            }
            base.UpdateStyles();
        }

        private void InitColors()
        {
            this._paletteBack.Style = PaletteBackStyle.ButtonStandalone;
            base.HotTrack = true;
            this.StandardBackColor = this._palette.ColorTable.ToolStripContentPanelGradientEnd;
            this.BorderColor = this._palette.ColorTable.ToolStripBorder;
            this.ButtonsBackColor = this._palette.ColorTable.ToolStripContentPanelGradientEnd;
            this.ButtonsBorderColor = this._palette.ColorTable.ToolStripBorder;
            this.TabColorHotDark = this._paletteBack.GetBackColor1(PaletteState.Tracking);
            this.TabColorHotLight = this._paletteBack.GetBackColor2(PaletteState.Tracking);
            this.TabColorSelectedDark = this._paletteBack.GetBackColor1(PaletteState.Pressed);
            this.TabColorSelectedLight = this._paletteBack.GetBackColor2(PaletteState.Pressed);
            this.TabColorPressedDark = this._paletteBack.GetBackColor1(PaletteState.CheckedTracking);
            this.TabColorPressedLight = this._paletteBack.GetBackColor2(PaletteState.CheckedTracking);
            if (!this._preserveTabColor)
            {
                this.TabForeColor = this._palette.ColorTable.StatusStripText;
                this.TabHotForeColor = this._palette.ColorTable.StatusStripText;
                this.TabSelectedForeColor = this._palette.ColorTable.StatusStripText;
            }
            else
            {
                this.TabForeColor = this._palette.ColorTable.MenuItemText;
                this.TabHotForeColor = this._palette.ColorTable.MenuItemText;
                this.TabSelectedForeColor = this._palette.ColorTable.MenuItemText;
            }
            this.TabColorDefaultDark = this._palette.ColorTable.ToolStripContentPanelGradientEnd;
            this.TabColorDefaultLight = this._palette.ColorTable.ToolStripGradientBegin;
            foreach (TabPage page in this.TabPages)
            {
                page.BackColor = this._palette.GetBackColor1(PaletteBackStyle.ControlClient, PaletteState.Normal);
            }
            base.Invalidate();
        }

        private void InitializeComponent()
        {
            this.components = new Container();
        }

        private bool IsFirstTabHidden()
        {
            float left = 0f;
            bool flag = false;
            if (base.TabCount <= 0)
            {
                return flag;
            }
            left = base.GetTabRect(0).Left;
            return (left < 0f);
        }

        private bool IsLastTabHidden()
        {
            bool flag = false;
            if (base.TabCount <= 0)
            {
                return flag;
            }
            return (base.GetTabRect(base.TabCount - 1).Right > this.Scroller.Left);
        }

        protected override void OnControlAdded(ControlEventArgs e)
        {
            base.OnControlAdded(e);
            for (int i = 0; i < base.TabCount; i++)
            {
                this.TabPages[i].Padding = new Padding(0);
                this.TabPages[i].Margin = new Padding(0);
            }
        }

        protected override void OnControlRemoved(ControlEventArgs e)
        {
            base.OnControlRemoved(e);
        }

        protected override void OnFontChanged(EventArgs e)
        {
            base.OnFontChanged(e);
            this.Scroller.Height = 0x17;
            this.Scroller.Width = 0x5c;
            this.OnResize(EventArgs.Empty);
        }

        private void OnGlobalPaletteChanged(object sender, EventArgs e)
        {
            if (this._palette != null)
            {
                this._palette.PalettePaint -= new EventHandler<PaletteLayoutEventArgs>(this.OnPalettePaint);
            }
            this._palette = KryptonManager.CurrentGlobalPalette;
            this._paletteRedirect.Target = this._palette;
            if (this._palette != null)
            {
                this._palette.PalettePaint += new EventHandler<PaletteLayoutEventArgs>(this.OnPalettePaint);
                this.InitColors();
            }
            base.Invalidate();
        }

        protected override void OnHandleCreated(EventArgs e)
        {
            base.OnHandleCreated(e);
            Win32.SetParent(this.Scroller.Handle, base.Handle);
            this.OnFontChanged(EventArgs.Empty);
        }

        protected override void OnMouseClick(MouseEventArgs e)
        {
            try
            {
                Point location = e.Location;
                if (this.m_closeRect.Contains(location))
                {
                    base.Controls.RemoveAt(base.SelectedIndex);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
            base.OnMouseClick(e);
        }

        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
        }

        protected override void OnMouseHover(EventArgs e)
        {
            base.OnMouseHover(e);
        }

        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);
            for (int i = 0; i < base.TabCount; i++)
            {
                this.TabPages[i].Tag = false;
            }
            base.Invalidate();
        }

        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            try
            {
                base.CreateGraphics();
                for (int i = 0; i < base.TabCount; i++)
                {
                    if (base.GetTabRect(i).Contains(e.X, e.Y) && (this.TabPages[i].Tag != null))
                    {
                        if (base.HotTrack)
                        {
                            if (!((bool) this.TabPages[i].Tag))
                            {
                                base.Invalidate();
                            }
                            this.TabPages[i].Tag = true;
                        }
                    }
                    else
                    {
                        if ((bool) this.TabPages[i].Tag)
                        {
                            base.Invalidate();
                        }
                        this.TabPages[i].Tag = false;
                    }
                }
            }
            catch (Exception)
            {
            }
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            this.DrawControl(e.Graphics);
        }

        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            base.OnPaintBackground(pevent);
            if (this._allowCloseButton)
            {
                this.Scroller.CloseButton.Visible = true;
            }
            else
            {
                this.Scroller.CloseButton.Visible = false;
            }
            if (this._allowContextButton)
            {
                this.Scroller.ContextMenuButton.Visible = true;
            }
            else
            {
                this.Scroller.ContextMenuButton.Visible = false;
            }
            if (!this.IsLastTabHidden() && !this.IsFirstTabHidden())
            {
                this._allowInternalNavigatorButtons = false;
            }
            else
            {
                this._allowInternalNavigatorButtons = true;
            }
            if (this._allowNavigatorButtons && this._allowInternalNavigatorButtons)
            {
                this.Scroller.LeftScroller.Visible = true;
                this.Scroller.RightScroller.Visible = true;
            }
            else
            {
                this.Scroller.LeftScroller.Visible = false;
                this.Scroller.RightScroller.Visible = false;
            }
            if (base.Multiline)
            {
                this._allowNavigatorButtons = false;
            }
            if (this._allowCloseButton)
            {
                if (this._allowNavigatorButtons && this._allowInternalNavigatorButtons)
                {
                    if (this._allowContextButton)
                    {
                        this.Scroller.Width = 0x5c;
                    }
                    else
                    {
                        this.Scroller.Width = 0x45;
                    }
                }
                else if (this._allowContextButton)
                {
                    this.Scroller.Width = 0x2e;
                }
                else
                {
                    this.Scroller.Width = 0x17;
                }
            }
            else if (this._allowNavigatorButtons && this._allowInternalNavigatorButtons)
            {
                if (this._allowContextButton)
                {
                    this.Scroller.Width = 0x45;
                }
                else
                {
                    this.Scroller.Width = 0x2e;
                }
            }
            else if (this._allowContextButton)
            {
                this.Scroller.Width = 0x17;
            }
            else
            {
                this.Scroller.Width = 0;
            }
            if (base.Alignment == TabAlignment.Top)
            {
                this.Scroller.Location = new Point((base.Width - this.Scroller.Width) - 1, 2);
            }
            else if (base.Alignment == TabAlignment.Bottom)
            {
                this.Scroller.Location = new Point((base.Width - this.Scroller.Width) - 1, (base.Height - this.Scroller.Height) - 1);
            }
            else if (base.Alignment == TabAlignment.Right)
            {
                this.Scroller.Location = new Point((base.Width - this.Scroller.Width) - 1, (base.Height - this.Scroller.Height) - 1);
            }
            else if (base.Alignment == TabAlignment.Left)
            {
                this.Scroller.Location = new Point(2, (base.Height - this.Scroller.Height) - 1);
            }
            this.pt = new Point(this.Scroller.Right - 0x17, this.Scroller.Bottom);
        }

        private void OnPalettePaint(object sender, PaletteLayoutEventArgs e)
        {
            base.Invalidate();
        }

        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);
            base.Invalidate(true);
            if (base.Alignment == TabAlignment.Top)
            {
                this.Scroller.Location = new Point((base.Width - this.Scroller.Width) - 1, 2);
            }
            else
            {
                this.Scroller.Location = new Point(base.Width - this.Scroller.Width, (base.Height - this.Scroller.Height) - 1);
            }
        }

        protected override void OnSelectedIndexChanged(EventArgs e)
        {
            base.OnSelectedIndexChanged(e);
        }

        protected override void OnSelecting(TabControlCancelEventArgs e)
        {
            try
            {
                if (!e.TabPage.ClientRectangle.Contains(this.m_closeRect))
                {
                    base.OnSelecting(e);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
                base.OnSelecting(e);
            }
        }

        protected override bool ProcessMnemonic(char charCode)
        {
            foreach (TabPage page in this.TabPages)
            {
                if (Control.IsMnemonic(charCode, page.Text))
                {
                    base.SelectedTab = page;
                    base.Focus();
                    return true;
                }
            }
            return base.ProcessMnemonic(charCode);
        }

        private void Scroller_ContextMenuButton(object sender, EventArgs e)
        {
            this.Scroller.ContextMenuStrip1.DropShadowEnabled = true;
            this.Scroller.ContextMenuStrip1.Items.Clear();
            int num = 0;
            foreach (TabPage page in this.TabPages)
            {
                try
                {
                    ToolStripMenuItem item;
                    if ((base.ImageList != null) && (page.ImageIndex >= 0))
                    {
                        item = new ToolStripMenuItem(page.Text, base.ImageList.Images[page.ImageIndex], new EventHandler(this.ToolstripItemEvent));
                    }
                    else
                    {
                        item = new ToolStripMenuItem(page.Text, null, new EventHandler(this.ToolstripItemEvent));
                    }
                    item.Tag = page;
                    this.Scroller.ContextMenuStrip1.Items.Add(item);
                    if (base.SelectedIndex == num)
                    {
                        item.Checked = true;
                    }
                }
                catch (Exception)
                {
                }
                num++;
            }
            this.Scroller.ContextMenuStrip1.Show(base.PointToScreen(this.pt));
        }

        private void Scroller_ScrollLeft(object sender, EventArgs e)
        {
            if (base.TabCount != 0)
            {
                int num = Math.Max(0, (this.ScrollPosition - 1) * 0x10000);
                Win32.SendMessage(base.Handle, 0x114, (IntPtr) (num | 4), IntPtr.Zero);
                Win32.SendMessage(base.Handle, 0x114, (IntPtr) (num | 8), IntPtr.Zero);
                base.Invalidate();
            }
        }

        private void Scroller_ScrollRight(object sender, EventArgs e)
        {
            if ((base.TabCount != 0) && (base.GetTabRect(base.TabCount - 1).Right > this.Scroller.Left))
            {
                int num = Math.Max(0, (this.ScrollPosition + 1) * 0x10000);
                Win32.SendMessage(base.Handle, 0x114, (IntPtr) (num | 4), IntPtr.Zero);
                Win32.SendMessage(base.Handle, 0x114, (IntPtr) (num | 8), IntPtr.Zero);
                base.Invalidate();
            }
        }

        private void Scroller_TabClose(object sender, EventArgs e)
        {
            if (base.SelectedTab != null)
            {
                this.TabPages.Remove(base.SelectedTab);
            }
        }

        private void this_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                Point location = e.Location;
                if (sender.Equals(base.Parent))
                {
                    location.Y = e.Location.Y - base.Location.Y;
                    location.X = e.Location.X - base.Location.X;
                }
                if (this.m_closeRect.Contains(location))
                {
                    base.Controls.RemoveAt(base.SelectedIndex);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }

        private void this_ParentChanged(object sender, EventArgs e)
        {
            try
            {
                base.Parent.MouseClick += new MouseEventHandler(this.this_MouseClick);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }

        private void ToolstripItemEvent(object sender, EventArgs e)
        {
            ToolStripMenuItem item = (ToolStripMenuItem) sender;
            TabPage tag = (TabPage) item.Tag;
            base.SelectedTab = tag;
            base.Invalidate();
        }

        [PermissionSet(SecurityAction.Demand, Name="FullTrust")]
        protected override void WndProc(ref Message m)
        {
            if ((m.Msg == 0x210) && (((ushort) (m.WParam.ToInt32() & 0xffff)) == 1))
            {
                StringBuilder pszType = new StringBuilder(0x10);
                Win32.RealGetWindowClass(m.LParam, pszType, 0x10);
                if (pszType.ToString() == "msctls_updown32")
                {
                    if (this.UpDown != null)
                    {
                        this.UpDown.ReleaseHandle();
                    }
                    this.UpDown = new NativeUpDown();
                    this.UpDown.AssignHandle(m.LParam);
                }
            }
            base.WndProc(ref m);
        }

        [Browsable(true), Category("Appearance-Extended")]
        public bool AllowCloseButton
        {
            get
            {
                return this._allowCloseButton;
            }
            set
            {
                this._allowCloseButton = value;
                base.Invalidate();
            }
        }

        [Browsable(true), Category("Appearance-Extended")]
        public bool AllowContextButton
        {
            get
            {
                return this._allowContextButton;
            }
            set
            {
                this._allowContextButton = value;
                base.Invalidate();
            }
        }

        [Category("Appearance-Extended"), Browsable(true)]
        public bool AllowNavigatorButtons
        {
            get
            {
                return this._allowNavigatorButtons;
            }
            set
            {
                this._allowNavigatorButtons = value;
                base.Invalidate();
            }
        }

        [Category("Appearance-Extended"), Browsable(true)]
        public bool AllowSelectedTabHigh
        {
            get
            {
                return this._allowSelectedTabHigh;
            }
            set
            {
                this._allowSelectedTabHigh = value;
                base.Invalidate();
            }
        }

        [Category("Appearance-Extended"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(true)]
        public Color BorderColor
        {
            get
            {
                return this._borderColor;
            }
            set
            {
                this._borderColor = value;
                base.Invalidate();
            }
        }

        [Category("Appearance-Extended"), Browsable(false)]
        public int BorderWidth
        {
            get
            {
                return this._borderWidth;
            }
            set
            {
                this._borderWidth = value;
                base.Invalidate();
            }
        }

        [Category("Appearance-Extended"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(true)]
        public Color ButtonsBackColor
        {
            get
            {
                return this._buttonsBackColor;
            }
            set
            {
                this._buttonsBackColor = value;
                base.Invalidate();
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Category("Appearance-Extended"), Browsable(true)]
        public Color ButtonsBorderColor
        {
            get
            {
                return this._buttonsBorderColor;
            }
            set
            {
                this._buttonsBorderColor = value;
                base.Invalidate();
            }
        }

        [Browsable(true), Category("Appearance-Extended")]
        public int CornerRoundRadiusWidth
        {
            get
            {
                return this._cornerRoundRadiusWidth;
            }
            set
            {
                this._cornerRoundRadiusWidth = value;
                base.Invalidate();
            }
        }

        [Browsable(true), Category("Appearance-Extended")]
        public CornSymmetry CornerSymmetry
        {
            get
            {
                return (CornSymmetry) this._cornerSymmetry;
            }
            set
            {
                this._cornerSymmetry = (int) value;
                switch (this._cornerSymmetry)
                {
                    case 0:
                        this._cornerLeftWidth = this._cornerWidth;
                        this._cornerRightWidth = this._cornerWidth;
                        break;

                    case 1:
                        this._cornerLeftWidth = 0;
                        this._cornerRightWidth = this._cornerWidth;
                        break;

                    case 2:
                        this._cornerLeftWidth = this._cornerWidth;
                        this._cornerRightWidth = 0;
                        break;
                }
                base.Invalidate();
            }
        }

        [Category("Appearance-Extended"), Browsable(true)]
        public AC.ExtendedRenderer.Toolkit.Drawing.DrawingMethods.CornerType CornerType
        {
            get
            {
                return this._cornerType;
            }
            set
            {
                this._cornerType = value;
                base.Invalidate();
            }
        }

        [Category("Appearance-Extended"), Browsable(true)]
        public CornWidth CornerWidth
        {
            get
            {
                return (CornWidth) this._cornerWidth;
            }
            set
            {
                this._cornerWidth = (int) value;
                switch (this._cornerSymmetry)
                {
                    case 0:
                        this._cornerLeftWidth = this._cornerWidth;
                        this._cornerRightWidth = this._cornerWidth;
                        break;

                    case 1:
                        this._cornerLeftWidth = 0;
                        this._cornerRightWidth = this._cornerWidth;
                        break;

                    case 2:
                        this._cornerLeftWidth = this._cornerWidth;
                        this._cornerRightWidth = 0;
                        break;
                }
                base.Invalidate();
            }
        }

        [Browsable(true), Category("Appearance-Extended")]
        public bool PreserveTabColor
        {
            get
            {
                return this._preserveTabColor;
            }
            set
            {
                this._preserveTabColor = value;
                base.Invalidate();
            }
        }

        private int ScrollPosition
        {
            get
            {
                Rectangle tabRect;
                int num = -1;
                do
                {
                    tabRect = base.GetTabRect(num + 1);
                    num++;
                }
                while ((tabRect.Left < 0) && (num < base.TabCount));
                return num;
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(true), Category("Appearance-Extended")]
        public Color StandardBackColor
        {
            get
            {
                return this._standardBackColor;
            }
            set
            {
                this._standardBackColor = value;
                base.Invalidate();
            }
        }

        [Browsable(true), Category("Appearance-Extended"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public Color TabColorDefaultDark
        {
            get
            {
                return this._tabColorDefaultDark;
            }
            set
            {
                this._tabColorDefaultDark = value;
                base.Invalidate();
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Category("Appearance-Extended"), Browsable(true)]
        public Color TabColorDefaultLight
        {
            get
            {
                return this._tabColorDefaultLight;
            }
            set
            {
                this._tabColorDefaultLight = value;
                base.Invalidate();
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(true), Category("Appearance-Extended")]
        public Color TabColorHotDark
        {
            get
            {
                return this._tabColorHotDark;
            }
            set
            {
                this._tabColorHotDark = value;
                base.Invalidate();
            }
        }

        [Category("Appearance-Extended"), Browsable(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public Color TabColorHotLight
        {
            get
            {
                return this._tabColorHotLight;
            }
            set
            {
                this._tabColorHotLight = value;
                base.Invalidate();
            }
        }

        [Browsable(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Category("Appearance-Extended")]
        public Color TabColorPressedDark
        {
            get
            {
                return this._tabColorPressedDark;
            }
            set
            {
                this._tabColorPressedDark = value;
                base.Invalidate();
            }
        }

        [Browsable(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Category("Appearance-Extended")]
        public Color TabColorPressedLight
        {
            get
            {
                return this._tabColorPressedLight;
            }
            set
            {
                this._tabColorPressedLight = value;
                base.Invalidate();
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(true), Category("Appearance-Extended")]
        public Color TabColorSelectedDark
        {
            get
            {
                return this._tabColorSelectedDark;
            }
            set
            {
                this._tabColorSelectedDark = value;
                base.Invalidate();
            }
        }

        [Category("Appearance-Extended"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(true)]
        public Color TabColorSelectedLight
        {
            get
            {
                return this._tabColorSelectedLight;
            }
            set
            {
                this._tabColorSelectedLight = value;
                base.Invalidate();
            }
        }

        [Browsable(true), Category("Appearance-Extended"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public Color TabForeColor
        {
            get
            {
                return this._tabForeColor;
            }
            set
            {
                this._tabForeColor = value;
                base.Invalidate();
            }
        }

        [Browsable(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Category("Appearance-Extended")]
        public Color TabHotForeColor
        {
            get
            {
                return this._tabHotForeColor;
            }
            set
            {
                this._tabHotForeColor = value;
                base.Invalidate();
            }
        }

        [Editor(typeof(TabpageExCollectionEditor), typeof(UITypeEditor))]
        public TabControl.TabPageCollection TabPages
        {
            get
            {
                return base.TabPages;
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(true), Category("Appearance-Extended")]
        public Color TabSelectedForeColor
        {
            get
            {
                return this._tabSelectedForeColor;
            }
            set
            {
                this._tabSelectedForeColor = value;
                base.Invalidate();
            }
        }

        [Category("Appearance-Extended"), Browsable(true)]
        public bool UseExtendedLayout
        {
            get
            {
                return this._useExtendedLayout;
            }
            set
            {
                if (value)
                {
                    base.SizeMode = TabSizeMode.Fixed;
                    base.Alignment = TabAlignment.Right;
                    base.DrawMode = TabDrawMode.OwnerDrawFixed;
                    base.ItemSize = new Size(0x19, 100);
                    base.Appearance = TabAppearance.Normal;
                }
                else
                {
                    base.SizeMode = TabSizeMode.Normal;
                    base.DrawMode = TabDrawMode.OwnerDrawFixed;
                    base.ItemSize = new Size(0x4d, 0x19);
                    base.Multiline = false;
                }
                this._useExtendedLayout = value;
            }
        }

        public enum CornSymmetry
        {
            Both,
            Right,
            Left
        }

        public enum CornWidth
        {
            Max = 6,
            Medium = 3,
            Null = 0,
            Overflow = 8,
            Thick = 4,
            Thin = 2
        }

        internal class NativeUpDown : NativeWindow
        {
            private Rectangle _bounds;
            private const int WM_DESTROY = 2;
            private const int WM_NCDESTROY = 130;
            private const int WM_WINDOWPOSCHANGING = 70;

            [PermissionSet(SecurityAction.Demand, Name="FullTrust")]
            protected override void WndProc(ref Message m)
            {
                if ((m.Msg == 2) || (m.Msg == 130))
                {
                    this.ReleaseHandle();
                }
                else if (m.Msg == 70)
                {
                    WINDOWPOS lParam = (WINDOWPOS) m.GetLParam(typeof(WINDOWPOS));
                    lParam.x += lParam.cx;
                    Marshal.StructureToPtr(lParam, m.LParam, true);
                    this._bounds = new Rectangle(lParam.x, lParam.y, lParam.cx, lParam.cy);
                }
                base.WndProc(ref m);
            }

            internal Rectangle Bounds
            {
                get
                {
                    return this._bounds;
                }
            }

            [StructLayout(LayoutKind.Sequential)]
            private struct WINDOWPOS
            {
                public IntPtr hwnd;
                public IntPtr hwndInsertAfter;
                public int x;
                public int y;
                public int cx;
                public int cy;
                public int flags;
            }
        }

        internal class TabpageExCollectionEditor : CollectionEditor
        {
            public TabpageExCollectionEditor(System.Type type) : base(type)
            {
            }

            protected override System.Type CreateCollectionItemType()
            {
                return typeof(TabPage);
            }
        }

        internal class TabScroller : Control
        {
            internal KryptonNavigatorButton CloseButton;
            private IContainer components;
            internal KryptonNavigatorButton ContextMenuButton;
            internal ContextMenuStrip ContextMenuStrip1;
            internal KryptonNavigatorButton LeftScroller;
            internal KryptonNavigatorButton RightScroller;

            public event EventHandler ContextualMenu;

            public event EventHandler ScrollLeft;

            public event EventHandler ScrollRight;

            public event EventHandler TabClose;

            public TabScroller()
            {
                base.SetStyle(ControlStyles.DoubleBuffer, true);
                base.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
                base.UpdateStyles();
                this.InitializeComponent();
            }

            private void CloseButton_Click(object sender, EventArgs e)
            {
                if (this.TabClose != null)
                {
                    this.TabClose(this, EventArgs.Empty);
                }
            }

            private void ContextMenuButton_Click(object sender, EventArgs e)
            {
                if (this.TabClose != null)
                {
                    this.ContextualMenu(this, EventArgs.Empty);
                }
            }

            protected override void Dispose(bool disposing)
            {
                if (disposing && (this.components != null))
                {
                    this.components.Dispose();
                }
                base.Dispose(disposing);
            }

            [DebuggerStepThrough]
            private void InitializeComponent()
            {
                this.RightScroller = new KryptonNavigatorButton();
                this.LeftScroller = new KryptonNavigatorButton();
                this.CloseButton = new KryptonNavigatorButton();
                this.ContextMenuButton = new KryptonNavigatorButton();
                this.ContextMenuStrip1 = new ContextMenuStrip();
                base.SuspendLayout();
                this.LeftScroller.Dock = DockStyle.Left;
                this.LeftScroller.Location = new Point(0, 0);
                this.LeftScroller.Name = "LeftScroller";
                this.LeftScroller.TabIndex = 0;
                this.LeftScroller.Text = "3";
                this.LeftScroller.Values.Text = "3";
                this.LeftScroller.Click += new EventHandler(this.LeftScroller_Click);
                this.RightScroller.Dock = DockStyle.Right;
                this.RightScroller.Location = new Point(0x17, 0);
                this.RightScroller.Name = "RightScroller";
                this.RightScroller.TabIndex = 1;
                this.RightScroller.Text = "4";
                this.RightScroller.Values.Text = "4";
                this.RightScroller.Click += new EventHandler(this.RightScroller_Click);
                this.CloseButton.Dock = DockStyle.Right;
                this.CloseButton.Location = new Point(0x2e, 0);
                this.CloseButton.Name = "CloseButton";
                this.CloseButton.TabIndex = 2;
                this.CloseButton.Text = "r";
                this.CloseButton.Values.Text = "r";
                this.CloseButton.Click += new EventHandler(this.CloseButton_Click);
                this.ContextMenuButton.Dock = DockStyle.Right;
                this.ContextMenuButton.Location = new Point(0x45, 0);
                this.ContextMenuButton.Name = "ContextMenuButton";
                this.ContextMenuButton.TabIndex = 3;
                this.ContextMenuButton.Text = "7";
                this.ContextMenuButton.Values.Text = "7";
                this.ContextMenuButton.Click += new EventHandler(this.ContextMenuButton_Click);
                this.ContextMenuStrip1.Font = new Font("Segoe UI", 9f);
                this.ContextMenuStrip1.Name = "ContextMenuStrip1";
                base.Controls.Add(this.LeftScroller);
                base.Controls.Add(this.RightScroller);
                base.Controls.Add(this.CloseButton);
                base.Controls.Add(this.ContextMenuButton);
                this.Font = new Font("Marlett", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 2);
                base.Name = "TabScroller";
                base.Size = new Size(0x45, 0x17);
                base.Resize += new EventHandler(this.TabScroller_Resize);
                this.BackColor = Color.Transparent;
                base.ResumeLayout(false);
            }

            private void LeftScroller_Click(object sender, EventArgs e)
            {
                if (this.ScrollLeft != null)
                {
                    this.ScrollLeft(this, EventArgs.Empty);
                }
            }

            private void RightScroller_Click(object sender, EventArgs e)
            {
                if (this.ScrollRight != null)
                {
                    this.ScrollRight(this, EventArgs.Empty);
                }
            }

            private void TabScroller_Resize(object sender, EventArgs e)
            {
            }
        }
    }
}

